package com.tihom;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author tihom
 */

@SpringBootApplication
@RestController
@EnableSwagger2
@EntityScan(basePackages = {"com.tihom.security.rbac.domain"})
public class DemoApplication {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(DemoApplication.class, args);
        ConfigurableEnvironment environment = context.getEnvironment();
        String property = environment.getProperty("server.port");
        System.out.println("项目启动完毕...访问地址: http://127.0.0.1:" + property + "/tihom-signIn.html");
    }

    @GetMapping("/hello")
    public String hello() {
        System.out.println("访问/hello...");
        return "hello spring security";
    }

    @GetMapping("/new/hello")
    public String newHello() {
        System.out.println("访问/new/hello...");
        return "new Hello spring security";
    }
}
